import 'package:flutter/material.dart';
import '../components/drawer_container.dart';
import '../pages/home_page.dart';
import '../pages/category_page.dart';
import '../pages/cart_page.dart';
import '../pages/member_page.dart';
// import '../components/toolbar_container.dart';


class ToorBarCotainer extends StatefulWidget {
  ToorBarCotainer({Key key}) : super(key: key);

  _ToorBarCotainerState createState() => _ToorBarCotainerState();
}

class _ToorBarCotainerState extends State<ToorBarCotainer> {
    final List tabBodies = [HomePage(), CategoryPage(), CartPage(), MemberPage()];
  int _currentIndex = 0;
  var currentPage;

  void _onTapHandler(int index) {
    setState(() {
      _currentIndex = index;
      currentPage = tabBodies[_currentIndex];
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('信号区'),
      ),
      endDrawer: DrawerContianer(),
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        onTap: _onTapHandler,
        type: BottomNavigationBarType.fixed,
        fixedColor: Colors.black,
        items: [
          BottomNavigationBarItem(
            icon: Icon(Icons.home),
            title: Text('home'),
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.history),
            title: Text('History'),
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.list),
            title: Text('List'),
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.person),
            title: Text('My'),
          ),
        ],
      ),
      body:currentPage,
    );
  }
}
